import Vue from 'vue'

import Cookies from 'js-cookie'

import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';


import './assets/styles/element-variables.scss'

import '@/assets/styles/index.scss' // global css
import '@/assets/styles/ruoyi.scss' // ruoyi css
import '@/assets/styles/common.css' // my css
import '@/assets/styles/demo.css' // my css

import '@/assets/icons/element-expansion/iconfont.css' // element 拓展图标

import Pagination from "@/components/Pagination";
import DashLine from '@/components/DashLine'

import * as echarts from 'echarts'

import App from './App'
import store from './store'
import router from './router'
import Router from 'vue-router'

// import directive from './directive' // directive


Vue.component('Pagination', Pagination)
Vue.component('DashLine', DashLine)


const originalPush = Router.prototype.push

Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}


Vue.prototype.$echarts = echarts

import { getDictList } from '@/api/dicts'
import {
  getConfigKey
} from '@/api/system/config';


import {
  parseTime,
  resetForm,
  addDateRange,
  selectDictLabel,
  selectDictLabels,
  download,
  handleTree
} from '@/utils/ruoyi';

// tailwind.css 引入
import './index.css'

// 自定义表格工具组件
// import RightToolbar from '@/components/RightToolbar'

// 自定义对文件预览 添加头缀
// import { addHeadFile } from '@/utils/aboutFile'

// 字典标签组件
// import DictTag from '@/components/DictTag'

// import Pagination from '@/components/Pagination';

// 富文本组件
// import Editor from '@/components/Editor'
// 文件上传组件
// import FileUpload from '@/components/FileUpload'
// // 图片上传组件
// import ImageUpload from '@/components/ImageUpload'

// 头部标签组件
import VueMeta from 'vue-meta'
// tinymce 富文本编辑器
// import tinymceEditor from '@/components/Tinymce/tinymce-editor.vue'

// 全局方法挂载
Vue.prototype.getDictList = getDictList
Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.download = download

Vue.prototype.handleTree = handleTree

Vue.prototype.msgSuccess = function (msg) {
  this.$message({
    showClose: true,
    message: msg,
    type: 'success'
  })
}

Vue.prototype.msgError = function (msg) {
  this.$message({
    showClose: true,
    message: msg,
    type: 'error'
  })
}

Vue.prototype.msgInfo = function (msg) {
  this.$message.info(msg)
}

// 全局组件挂载
// Vue.component('DictTag', DictTag)
// Vue.component('FileUpload', FileUpload)
// Vue.component('ImageUpload', ImageUpload)

// Vue.component('Pagination', Pagination)
// Vue.component('Editor', Editor)
// Vue.component('tinymce-editor', tinymceEditor)


Vue.use(VueMeta)

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online! ! !
 */

Vue.use(Element, {
  size: Cookies.get('size') || 'medium' // set element-ui default size
})

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
